/*
 * IGameLogic.h
 *
 *  Created on: 21.01.2013
 *      Author: Kirill Blinov
 *   Copyright: LGPL
 */

#ifndef IGAMELOGIC_H_
#define IGAMELOGIC_H_

#include <vector>
#include "../../BasicTypes.h"
#include "../../Manager Resource/CGameWorld.h"
#include "../../GUI/GuiBase.h"

/*
 * Basic class to inherit game logic implementation
 */
class IGameLogic
{
friend class GameLogicFabric;
protected:
	 CGameWorld::CGameWorldUnitIterator*  unitIterator;

protected:
	IGameLogic( CGameWorld::CGameWorldUnitIterator* UnitIterator );
	virtual ~IGameLogic();

public:
	/*
	 * Loads messages and other lookup tables
	 */
	template <class TableContentFirst, class TableContentSecond>
	void LoadDataTable( const GAME_LOGIC_DATA_TABLE_TYPE TableType,
			            const std::vector< std::pair<TableContentFirst, TableContentSecond> > TableContent ) = 0;

	void ProcessInputMessage( const INPUT_MESSAGE &Message ) = 0;
	void ProcessUIMessage( const UI_MESSAGE &Message ) = 0;
	void ProcessKernelEvent(  ) = 0;

	/*
	 * This function is called every kernel frame after all messages
	 * are processed.
	 *
	 * returns TRUE  if kernel can go on working
	 *         FALSE to terminate kernel
	 */
	bool OnKernelFrame() = 0;
};

#endif /* IGAMELOGIC_H_ */
